<!DOCTYPE html>
<html lang="en">
<head>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="UTF-8">
    <title>区域意向客户详情页new</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="/dist/css/oa-app.css">
    <style>
        .title {
            text-align: center;
            font-weight: bold;
        }
        .boxBoy {
            background: #fff;
        }
        .boxItem {
            width: 100%;
            margin-top: -1px;
            padding-bottom: 0;
            background: inherit;
            background-color: rgba(255, 255, 255, 1);
            border: none;
            position: relative;
        }
        .biTian {
            position: absolute;
            margin-left: -10px;
            margin-top: 1px;
        }
        .tdInput {
            color: #2a8cec;
            border: none;
            outline: none;
            font-size: 12px;
        }
        .lineTwo span {
            max-height: 55px;
            line-height: 16px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
            text-align: left;
            padding: 5px;

        }
        .lineOne {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }
        .lineOne, .lineTwo {
            text-align: left;
        }
        #app select{
            font-size: 12px;
        }
        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }
        .div-td-content-more i {
               width: 15px;
               height: 12px;
              /* background: url("/dist/img/more-icon.png");*/
               position: absolute;
               left: 50px;
               top: -12px;
           }
        .hidden {
            display: none;
        }
        .model-picker-dropdown {
            position: absolute;
            width: 315px;
            left: -9999px;
            top: -9999px;
            outline: 0;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            z-index: 999999;
            display: none;
            min-width: 200px;
            margin-bottom: 20px;
            margin-top: 5px
        }

        .model-select-wrap {
            box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5)
        }

        .model-select-tab {
            border-bottom: 1px solid #ccc;
            background: #f5f5f5;
            font-size: 13px
        }

        .model-select-tab > a {
            display: inline-block;
            padding: 4px 20px;
            border-left: 1px solid #ccc;
            border-bottom: 1px solid transparent;
            color: #4D4D4D;
            text-align: center;
            outline: 0;
            text-decoration: none;
            cursor: pointer;
            font-size: 14px;
            margin-bottom: -1px
        }

        .model-select-tab > a.active {
            background: #fff;
            border-bottom: 1px solid #fff;
            color: #46A4FF
        }

        .model-select-tab > a:first-child {
            border-left: none
        }

        .model-select-tab > a:last-child.active {
            border-right: 1px solid #ccc
        }

        .model-select-content {
            width: 100%;
            min-height: 50px;
            background-color: #fff;
            padding: 5px 5px
        }

        .model-select {
            font-size: 12px
        }

        .model-select dl {
            line-height: 2;
            clear: both;
            padding: 3px 0;
            margin: 0;
            max-height: 200px;
            overflow-y: scroll
        }

        .model-select dt {
            position: absolute;
            width: 2.5em;
            font-weight: 500;
            text-align: right;
            line-height: 2
        }

        .model-select dd {
            margin-left: 0;
            line-height: 2
        }

        .model-select.province dd {
            margin-left: 3em
        }

        .model-select a {
            display: inline-block;
            padding: 0 10px;
            outline: 0;
            white-space: nowrap;
            margin-right: 2px;
            text-decoration: none;
            color: #333;
            cursor: pointer
        }

        .model-select a:hover, .model-select a:focus {
            background-color: #f1f8ff;
            border-radius: 2px;
            color: #46A4FF
        }

        .model-select a.active {
            background-color: #46A4FF;
            color: #fff;
            border-radius: 2px
        }
        .lable {
            width: 33%;
            height: 20px;
            line-height: 20px;
            display: block;
            float: left;
        }
    </style>
</head>
<body>
<section id="app"  style="padding-bottom: 49px;">
    <div class="div-td-content-more" style="z-index: 11112"><i></i></div>
    <div class="model-picker-dropdown">
        <div class="model-select-wrap">
            <div class="model-select-tab">
                <a class="active" data-count="type">省</a><a class="" data-count="brand">市</a><a data-count="model" class="">县</a>
            </div>
            <div class="model-select-content">
                <div class="model-select type shen" data-count="type" style="display: block;">
                    <dl class="clearfix">
                        <a class="" :attr-id="item.id" v-for="(item,i) in provinceList">{{item.name}}</a>
                    </dl>
                </div>
                <div class="model-select brand" data-count="province">
                    <dl class="clearfix">
                        <a class="" :attr-id="item.id" v-for="(item,i) in cityList">{{item.name}}</a>
                    </dl>
                </div>
                <div class="model-select model" data-count="model">
                    <dl class="clearfix">
                        <a class="" :attr-id="item.id" v-for="(item,i) in countyList">{{item.name}}</a>
                    </dl>
                </div>
            </div>
        </div>
    </div>
    <div class="td-value1"
         style="padding: 10px 0px 10px 20px; margin-left: 0px;display: none;position: absolute;z-index:999; border: 1px solid #DEDEDE; !important;margin-left: 0px;background-color: white"
         id="selectModel">
        <div>
            <template v-if="pageType=='edit'">
                <div v-for="(item,i) in itemsDeviceType" style="overflow: hidden">
                    <div>{{item.name}}：</div>
                    <label v-for="(item2,index) in item.itemsMod" class="lable">
                        <input type="checkbox" value="item2.modelName" style="float: left"
                               :checked="checkedModelCustomerLists.indexOf(item2.modelName)>=0"
                               @click="checkedOne(item2.modelName)"/><span class="lineOne">{{item2.modelName}}</span>
                    </label>
                </div>
                <br>
            </template>
        </div>
        <div style="text-align: center">
            <input type="button" value="确定" class="btn oaBtn btn-xs"
                   @click="getIntentionModel()">
            <input type="button" value="取消" class="btn oaBtn btn-xs" style="margin-left: 12px;margin-top: 25px; "
                   @click="hiddenDivModel()">
        </div>
    </div>
    <table class="oa-table ">
        <thead>
        <tr class="oa-table-title">
            <th>基本信息</th>
        </tr>
        </thead>
    </table>
    <table class="oa-table ">
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>姓名</th>
            <td style="width:25%;">
                <input type="text" v-if="pageType=='edit'" v-model="customerInfo.name"
                                          style="width: 100%;padding-left: 4px;border: none;color: rgb(42, 140, 236);" class="tdInput"></td>
                <span v-else>{{customerInfo.name}}</span>
            <th style="width: 25%"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>电话</th>
            <td style="width: 25%">
                <input type="text" v-if="pageType=='edit'" v-model="customerInfo.tel"
                                          style="width: 100%;padding-left: 4px;border: none;color: rgb(42, 140, 236);" class="tdInput"></td>
                <span v-else>{{customerInfo.tel}}</span>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>类型</th>
            <td style="text-align:left !important;width:25%;">
            <select id="customerType" v-if="pageType=='edit'"  v-model="customerInfo.customerType"
                    style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">
                <option selected="selected">客户(个人)</option>
                <option>客户(企业)</option>
                <option>中介(个人)</option>
                <option>中介(企业)</option>
            </select>
                <span v-else>{{customerInfo.customerType}}</span>
        </td>
            <th style="width: 25%"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>信用</th>
            <td style="text-align:left !important;width:25%;">
                <select id="customerCredit" v-if="pageType=='edit'"  v-model="customerInfo.customerCredit"
                        style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">
                    <option selected="selected">未知</option>
                    <option>合格</option>
                    <option>不合格</option>
                </select>
                <span v-else style="width: 100%"> {{customerInfo.customerCredit}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;">生日</th>
            <td style="width:25%;">
                <input type="text"  v-if="pageType=='edit'" v-model="customerInfo.birthday"  placeholder=例:1993-05-18
                                          style="width: 100%;padding-left: 4px;border: none;color: rgb(42, 140, 236);" class="tdInput"></td>
            <span v-else>{{customerInfo.birthday}}</span>
            <th style="width: 25%">微信</th>
            <td style="width: 25%">
                <input type="text"   v-if="pageType=='edit'" v-model="customerInfo.wechat"
                                          style="width: 100%;padding-left: 4px;border: none;color: rgb(42, 140, 236);" class="tdInput"></td>
            <span v-else>{{customerInfo.wechat}}</span>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>来源</th>
            <td style="text-align: left !important;">
                <select id="source" v-if="pageType=='edit'"  v-model="customerInfo.source"
                        style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">
                    <option selected="selected">销售录入</option>
                    <option>易企秀</option>
                    <option>400</option>
                    <option>其他</option>
                </select>
                <span v-else> {{customerInfo.source}}</span>
            </td>
            <th style="width: 25%"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>成交概率</th>
            <td style="text-align: left !important;">
                <select id="chance" v-if="pageType=='edit'"  v-model="customerInfo.chance"
                        style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">
                    <option selected="selected"><50%</option>
                    <option>50%</option>
                    <option>75%</option>
                    <option>100%</option>
                </select>
                <span v-else> {{customerInfo.chance}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>是否意向客户</th>
            <td v-if="pageType=='edit'" style="text-align: left;">
                                  <span v-if="currentFlag" style="display: flex;align-items: center;">
                                  <input class="tdInput"
                                         type="radio" id="on"
                                         value="1" v-model="customerInfo.intentionFlag">
                                  <label for="on" style="width: 45%;color: #2a8cec;">是</label>
                                  <input class="tdInput"
                                         type="radio" id="un"
                                         value="0" v-model="customerInfo.intentionFlag">
                                  <label for="un" style="color: #2a8cec;">否</label>
                              </span>
            </td>
            <td v-else style="text-align: left;">
                {{customerInfo.intentionFlag=='1'?'是':'否'}}
            </td>
            <th style="width: 25%"><i class="biTian" >*</i>成交状态</th>
            <td class="td-value" style="width: 25%;text-align:left !important;">
                <select id="" v-if="pageType=='edit'"
                        v-model="customerInfo.status" @change="c_status()"
                        style="background-color: white;color: #2a8cec;border-style:none;width:100%;outline: none;">
                    <option>跟踪中</option>
                    <option>已成交</option>
                    <option>丢单</option>
                </select>
                <span v-else>{{customerInfo.status}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>地址</th>
            <td v-if="pageType=='edit'" colspan="3" style="text-align: left;color: #2a8cec;" class="selectModel"
                @click="selectAddress()">
                            <span type="text" style="width: 100%;padding-left: 4px;"
                                  v-if="customerInfo.provinceName!=''">{{customerInfo.provinceName}}-{{customerInfo.cityName}}-{{customerInfo.countyName}}</span>
                <span v-else style="padding-left: 4px;">请选择</span>
            </td>
            <td v-else colspan="3" style="text-align: left;">
                {{customerInfo.provinceName}}-{{customerInfo.cityName}}-{{customerInfo.countyName}}
            </td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>对应区域</th>
            <td colspan="3" style="text-align: left;color: rgb(42, 140, 236);"  >
                <select v-model="customerInfo.regionId"
                        style="background-color: white;color: #2a8cec;border-style:none;width:100%;outline: none;" @change="getGenZrByRegionId()">
                    <option v-for="(item,i) in regionList" :value="item.regionId">
                        {{item.regionName}}
                    </option>
                </select>
            </td>
        </tr>
        <tr class="oa-table-title-gray" style="color: red">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>跟踪人</th>
            <td colspan="3" style="text-align: left;color: rgb(42, 140, 236);"  >
                <span style="padding-left: 4px;">{{genZR}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;">首次创建时间</th>
            <td style="width:25%;">
                <span style="padding-left: 4px;color: rgb(42, 140, 236);" v-if="customerInfo.createTime"> {{formatDate(customerInfo.createTime)}}</span>
                <span style="padding-left: 4px;color: rgb(42, 140, 236);" v-else> </span>
            </td>
            <th style="width: 25%">最新修改时间</th>
            <td style="width: 25%">
                <span  style="padding-left: 4px;color: rgb(42, 140, 236);"v-if="customerInfo.createTime"> {{formatDate(customerInfo.updateTime)}}</span>
                <span  style="padding-left: 4px;color: rgb(42, 140, 236);"v-else> </span>
            </td>
        </tr>
    </table>
    <table class="oa-table " v-if="customerInfo.intentionFlag=='1'">
        <thead>
        <tr class="oa-table-title">
            <th>意向设备</th>
        </tr>
        </thead>
    </table>
    <table class="oa-table " v-if="customerInfo.intentionFlag=='1'">
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>意向品牌</th>
            <td style="text-align:left !important;" colspan="3">
                <select v-if="pageType=='edit'" id="testBran"
                        v-model="customerInfo.intentionBrand"
                        style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;"
                        @change="getModel">
                    <option value=""></option>
                    <option v-for="itemB in itemsBran" v-bind:value="itemB.brandName">
                        {{itemB.brandName}}
                    </option>
                </select>
                <span v-else style="width: 100%"> {{customerInfo.intentionBrand}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>意向机型</th>
            <td style="text-align:left !important;" colspan="3">
               <span @click="showDivModel($event)"
                     style="width: 100%; padding-left: 4px;   height: 28px;line-height: 28px;display: block;color: rgb(42, 140, 236);">{{customerInfo.intentionModel}} </span>

            </td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;">限价(万)</th>
            <td style="text-align:left !important;" colspan="3">
                <input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                       readonly="readonly"
                       type="text" v-model="customerInfo.limitedPrice">
                <span v-else style="display: block;text-align: center">{{customerInfo.limitedPrice}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>购买方式</th>
            <td class="td-value" style="width: 25%;text-align:left !important;" colspan="3">
                <select id="buyType" v-if="pageType=='edit'"
                        v-model="customerInfo.buyType"
                        style="background-color: white;color: #2a8cec;border-style:none;width:100%;outline: none;">
                    <option selected="selected">全款</option>
                    <option>内部分期</option>
                    <option>融资租赁</option>
                </select>
                <span v-else>{{customerInfo.buyType}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>购买时间</th>
            <td style="width: 25%;text-align:left !important;">
                <select id="buyDate" v-if="pageType=='edit'"
                        v-model="customerInfo.buyDate" @change="YJCJSJFunction()"
                        style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">

                    <option v-for="(item,index) in buyDateList" :value="item.key">
                        {{item.value}}
                    </option>
                </select>
                <span v-else>{{customerInfo.buyDate}}</span>
            </td>
            <th style="width: 25%"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>预计成交时间</th>
            <td class="td-value" style="width: 25%;text-align:left !important;">
                <select id=" " v-if="pageType=='edit'"
                        v-model="customerInfo.yjOkDate"
                        style="background-color: white;color: #2a8cec;border-style:none;width:100%;outline: none;">
                    <option selected="selected"></option>
                    <option v-for="(item,index) in YJCJSJ">
                        {{item}}
                    </option>

                </select>
                <span v-else>{{customerInfo.yjOkDate}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>报价(万)</th>
            <td style="text-align:left !important;">
                <input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                        type="text" v-model="customerInfo.quote"
                        @blur="checkNum(customerInfo.quote,'quote')"/>
                <span v-else style="display: block;text-align: center">{{fmoney(customerInfo.quote)}}</span>
            </td>
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>心理价格(万)</th>
            <td style="text-align:left !important;">
                <input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                       type="text" v-model="customerInfo.psychologicalPrice"
                       @blur="checkNum(customerInfo.psychologicalPrice,'psychologicalPrice')"/>
                <span v-else style="display: block;text-align: center">{{fmoney(customerInfo.psychologicalPrice)}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;">首付比例</th>
            <td style="text-align:left !important;position: relative;" colspan="3">
                <input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                       type="text" v-model="customerInfo.paymentRatio"/>
                <span v-else style="display: block;text-align: center">{{customerInfo.paymentRatio}}</span>
                <span style="position: absolute;left: 35px;top: 1px;color: rgb(42, 140, 236);">%</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;">定金状态</th>
            <td class="td-value" style="width: 25%;text-align:left !important;">
                <select v-if="pageType=='edit'"
                        v-model="customerInfo.earnestStatus"
                        style="background-color: white;color: #2a8cec;border-style:none;width:100%;outline: none;">
                    <option value="未交">未交</option>
                    <option value="已交">已交</option>

                </select>
                <span v-else>{{customerInfo.earnestStatus}}</span>
            </td>
            <th style="width: 25%">定金金额(万)</th>
            <td style="width: 25%"><input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                                          type="text" v-model="customerInfo.earnestMoney"
                                          @blur="checkNum(customerInfo.earnestMoney,'earnestMoney')"/>
                <span v-else
                      style="display: block;text-align: center">{{fmoney(customerInfo.earnestMoney)}}</span></td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;" >首付预计收款日期</th>
            <td style="width: 25%"><input class="tdInput" @focus="showDatePicker($event)"
                                          v-model="customerInfo.paymentDate" v-if="pageType=='edit'"
                                          style="width: 100%;border: 0px" type="text"
            />
                <span v-else class="pull-left "
                      style="margin-left: 10px;">{{customerInfo.paymentDate}}</span></td>
            <th style="width: 25%">收款金额(万)</th>
            <td style="width: 25%"><input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                                          type="text" v-model="customerInfo.amountCollect"
                                          @blur="checkNum(customerInfo.amountCollect,'amountCollect')"/>
                <span v-else style="display: block;text-align: center">{{fmoney(customerInfo.amountCollect)}}</span></td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>是否置换</th>
            <td v-if="pageType=='edit'" style="text-align: left;">
                                  <span v-if="currentFlag" style="display: flex;align-items: center;">
                                  <input class="tdInput"
                                         type="radio" id="on1"
                                         value="1" v-model="customerInfo.ifReplace">
                                  <label for="on1" style="width: 24px;color: #2a8cec;">是</label>
                                  <input class="tdInput" style="margin-left: 3px"
                                         type="radio" id="un1"
                                         value="0" v-model="customerInfo.ifReplace">
                                  <label for="un1" style="color: #2a8cec;">否</label>
                              </span>
            </td>
            <td v-else style="text-align: left;">
                {{customerInfo.ifReplace=='1'?'是':'否'}}
            </td>
            <th style="width: 25%" v-if="customerInfo.ifReplace=='0'"></th>
            <th style="width: 25%" v-if="customerInfo.ifReplace=='1'"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>置换品牌机型</th>
            <td style="width: 25%"v-if="customerInfo.ifReplace=='0'"></td>
            <td style="width: 25%"v-if="customerInfo.ifReplace=='1'"><input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                                                                            type="text" v-model="customerInfo.replaceType"/>
                <span v-else style="display: block;text-align: center">{{customerInfo.replaceType}}</span></td>
        </tr>
        <tr class="oa-table-title-gray" v-if="customerInfo.ifReplace=='1'">
            <th style="width: 25%"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>评估价(万)</th>
            <td style="width: 25%"><input v-if="pageType=='edit'" class="tdInput replaceInput"
                                          style="width: 100%;padding-left: 4px;"
                                          type="text" v-model="customerInfo.valuationPrice"
                                          @blur="checkNum(customerInfo.valuationPrice,'valuationPrice')"/>
                <span v-else style="display: block;text-align: center">{{fmoney(customerInfo.valuationPrice)}}</span></td>
            <th style="width: 25%"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>客户要价(万)</th>
            <td style="width: 25%"> <input v-if="pageType=='edit'" class="tdInput replaceInput"
                                           style="width: 100%;padding-left: 4px;"
                                           type="text" v-model="customerInfo.customerAsk"
                                           @blur="checkNum(customerInfo.customerAsk,'customerAsk')"/>
                <span v-else
                      style="display: block;text-align: center">{{fmoney(customerInfo.customerAsk)}}</span></td>
        </tr>
        <tr class="oa-table-title-gray">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>设备用途</th>
            <td style="text-align: left;" colspan="3"  v-if="pageType=='edit'">
                <span v-if="currentFlag" style="display: flex;align-items: center;">
                                  <input class="tdInput" id="self"
                                         type="radio"
                                         value="1" v-model="customerInfo.deviceUse">
                                  <label for="self" style="width: 24px;color: #2a8cec;">自用</label>
                                  <input class="tdInput" id="unself" style="margin-left: 3px"
                                         type="radio"
                                         value="0" v-model="customerInfo.deviceUse">
                                  <label for="unself" style="color: #2a8cec;">非自用</label>
                              </span>
                <span v-else class="pull-left" style="margin-left: 18.5%">{{flag.value=='1'?'是':'否'}}</span>
            </td>
            <td v-else style="text-align: left;" colspan="3">
                {{customerInfo.deviceUse==0 ? '非自用':'自用'}}
            </td>
        </tr>
        <tr class="oa-table-title-gray" style="height: 55px;">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>现有设备</th>
            <td style="width: 25%" colspan="3"  class="lineTwo">
                <textarea class="tdInput"  v-if="pageType=='edit'" type="text" v-model="customerInfo.existingDevice"
                          placeholder="请填写客户现有设备及使用情况"
                          style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                </textarea>
                <span v-else
                      style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.existingDevice}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray" style="height: 55px;">
            <template v-if="pageType=='edit'">
                <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>从业经验</th>
            </template>
            <template v-else>
                <td class="tdColor">从业经验</td>
            </template>
            <td style="width: 25%" colspan="3"  class="lineTwo">
                <textarea class="tdInput" v-if="pageType=='edit'" type="text"
                          v-model="customerInfo.workingExperience"
                          placeholder="请填写客户以前和现在从事过的行业及相关经验"
                          style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                </textarea>
                <span v-else
                      style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.workingExperience}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray" style="height: 55px;">
            <template v-if="pageType=='edit'">
                <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>工程情况</th>
            </template>
            <template v-else>
                <td class="tdColor">工程情况</td>
            </template>
            <td style="width: 25%" colspan="3"  class="lineTwo">
               <textarea class="tdInput" v-if="pageType=='edit'" type="text"
                         v-model="customerInfo.buildCondition"
                         style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                            </textarea>
                <span v-else
                      style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.buildCondition}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray" style="height: 55px;">
            <template v-if="pageType=='edit'">
                <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>收入预测</th>
            </template>
            <template v-else>
                <td class="tdColor">收入预测</td>
            </template>
            <td style="width: 25%" colspan="3"  class="lineTwo">
               <textarea class="tdInput" v-if="pageType=='edit'" type="text"
                         v-model="customerInfo.revenueForecast"
                         style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                            </textarea>
                <span v-else
                      style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.revenueForecast}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray" style="height: 55px;">
            <template v-if="pageType=='edit'">
                <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>竞争对手</th>
            </template>
            <template v-else>
                <td class="tdColor">竞争对手</td>
            </template>

            <td style="width: 25%" colspan="3"  class="lineTwo">
               <textarea class="tdInput" v-if="pageType=='edit'"
                         placeholder="请填写竞争对手的商务条件" type="text"
                         v-model="customerInfo.competitorCondition"
                         style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                            </textarea>
                <span v-else
                      style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.competitorCondition}}</span>
            </td>
        </tr>
        <tr class="oa-table-title-gray" style="height: 55px;">
            <th style="width:25%;">拜访内容</th>
            <td style="width: 25%" colspan="3"  class="lineTwo">
                 <textarea class="tdInput" v-if="pageType=='edit'" type="text"
                           v-model="customerInfo.otherCondition"
                           style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                            </textarea>
                <span v-else
                      style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.otherCondition}}</span>
            </td>
        </tr>
    </table>
    <table class="oa-table " v-if="customerInfo.status=='丢单'">
        <thead>
        <tr class="oa-table-title">
            <th>丢单详情</th>
        </tr>
        </thead>
    </table>
    <table class="oa-table " v-if="customerInfo.status=='丢单'">
        <tr class="oa-table-title-gray" style="height: 55px;">
            <th style="width:25%;"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>丢单原因</th>
            <td  colspan="3"  class="lineTwo">
                <textarea class="tdInput" v-if="pageType=='edit'" type="text"
                          v-model="customerInfo.throwReason"
                          style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                            </textarea>
                <span v-else
                      style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.throwReason}}</span>
            </td>
        </tr>
    </table>
    <table class="oa-table"  v-if="customerVisitList && customerVisitList.length>0">
        <thead>
        <tr class="oa-table-title">
            <th>跟踪历史
                <span class="iconfont icon-zhankai"
                      v-if="btns==0 && customerVisitList.length>1"
                      @click="btns=1"></span>
                <span class="iconfont icon-shouqi"
                      v-if="btns==1&& customerVisitList.length>1"
                      @click="btns=0"></span>
        </tr>
        </thead>
    </table>
    <table class="oa-table " style="color: #2a8cec; ">
        <template v-if="btns==0">
            <template v-for="(item,i) in customerVisitList" v-if="i<3">
                <tr>
                    <td class="tdColor"
                        style="width: 25%;border-bottom: 4px solid #2c8cec">拜访时间
                    </td>
                    <td style="text-align: left;padding-left: 8px;">
                        {{formatDate(item.createTime)}}
                    </td>
                    <td class="tdColor" style="width: 25%;">拜访方式</td>
                    <td style="width: 25%;text-align: left;">
                        <span v-if="item.visitModel==='0'">电访</span>
                        <span v-else-if="item.visitModel==='1'">面访</span>
                        <span v-else></span>
                    </td>
                </tr>
                <tr>
                    <td class="tdColor">拜访人员</td>
                    <td colspan="3" style="text-align: left;padding-left: 8px;">
                        {{item.createUserName}}
                    </td>
                </tr>
                <tr>
                    <td class="tdColor">拜访内容</td>
                    <td colspan="3" class="lineTwo">
                        <span style="height: 55px;">{{item.otherCondition}}</span>
                    </td>
                </tr>
            </template>
        </template>
        <template v-else>
            <template v-for="(item,i) in customerVisitList">
                <tr>
                    <td class="tdColor"
                        style="width: 25%;border-bottom: 4px solid #2c8cec">拜访时间
                    </td>
                    <td style="text-align: left;padding-left: 8px;">
                        {{item.createTime}}
                    </td>
                    <td class="tdColor" style="width: 25%;">拜访方式</td>
                    <td style="width: 25%;text-align: left;">
                        <span v-if="item.visitModel==='0'">电访</span>
                        <span v-else-if="item.visitModel==='1'">面访</span>
                        <span v-else></span>
                    </td>
                </tr>
                <tr>
                    <td class="tdColor">拜访人员</td>
                    <td colspan="3" style="text-align: left;padding-left: 8px;">
                        {{item.createUserName}}
                    </td>
                </tr>
                <tr>
                    <td class="tdColor">拜访内容</td>
                    <td colspan="3" class="lineTwo">
                        <span style="height: 55px;">{{item.otherCondition}}</span>
                    </td>
                </tr>
            </template>
        </template>
    </table>

    <div >
        <div class="oa-footer-btn"  @click="save()" v-if="(pageType!='look'&&isAdd=='1')||(pageType=='edit'&&editBtn)" >保存</div>
    </div>
</section>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="https://file.ggxqce.com/web/axios.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script src="/dist/js/newOaApp.js"></script>
<script>
    $(function () {
        $("body").on("click", ".model-select-tab a", function (e) {
            $(this).parent().find("a").removeClass("active");
            $(this).addClass("active");
            var boxName = $(this).attr("data-count");
            $(".model-select").hide();
            $(".model-select-content" + " ." + boxName).show();
        });
        $("body").on("click", ".model-select  a", function (e) {
            $(this).parent().find("a").removeClass("active");
            var id = $(this).attr("attr-id");
            $(this).addClass("active");
            var val = $(this).text();
            if ($(this).parents(".model-select").hasClass("type")) {
                $(".model-select-tab a").removeClass("active");
                $(".model-select-tab a[data-count=brand]").addClass("active");
                $(".model-select").hide();
                $(".xianValue").attr("data-shen", val);
                app.customerInfo.provinceName = val;
                app.getCity(id);
                $(".model-select-content .brand").show();

            } else if ($(this).parents(".model-select").hasClass("brand")) {
                $(".model-select-tab a").removeClass("active");
                var id = $(this).attr("attr-id");
                $(".model-select-tab a[data-count=model]").addClass("active");
                $(".model-select").hide();
                $(".xianValue").attr("data-shi", val);
                app.getCounty(id);
                $(".model-select-content .model").show();
                app.customerInfo.cityName = val
            } else {
                $(".xianValue").attr("data-xian", val);
                $(".xianValue").val($(".xianValue").attr("data-shen") + "-" + $(".xianValue").attr("data-shi") + "-" + $(".xianValue").attr("data-xian"));
                app.customerInfo.countyName = val
                app.customerInfo.regionId='';
                app.genZR='';
                console.log(app.genZR)
                app.getRegionByAddress("1");

                console.log(val)
                $(".model-picker-dropdown").hide();
            }
        })
        $("body").on("click", ".model-picker-dropdown", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".model-picker-dropdown").hide();
        });
        $("body").on("click", ".selectModel", function (e) {
            if ($(".model-picker-dropdown").is(":hidden")) {
                $(".model-picker-dropdown").css({
                    "width": $(this).outerWidth() + "px",
                    "left": "100px",
                    "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                }).show();
                e.stopPropagation();
            } else {
                $(".model-picker-dropdown").hide();
            }
        });
        $("body").on("click", ".lineOne,.lineTwo", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>

<script type="text/javascript">
    var app = new Vue({
        el: "#app",
        data: {
            currentFlag: '0',
            userId: getUrlParamObj().userId,
            companyId: getUrlParamObj().companyId,
            type: getUrlParamObj().type,
            index: getUrlParamObj().index,
            list: [],
            customerId: getUrlParamObj().customerId,
            isAdd: getUrlParamObj().isAdd,
            newPager: getUrlParamObj().newPager,
            regionList:[],
            genZR:'',
            provinceList: [],
            cityList: [],
            userInfo: {},
            countyList: [],
            pageType: 'edit',
            selectBran: "请选择品牌",
            selectMod: "请选择型号",
            itemsBran: [],
            itemsDeviceType: [],
            buyDateObj: {},
            buyDateList: [],
            intent: [
                {text: '是', value: '1'},
                {text: '否', value: '0'},
            ],
            today: new Date(),
            customerInfo: {
                id: "",
                name: "",
                tel: "",
                birthday: "",
                buildCondition: "",
                buyDate: "",
                buyType: "",
                cityName: "",
                competitorCondition: "",
                countyName: "",
                customerCredit: "",
                customerType: "",
                deviceUse: "",
                existingDevice: "",
                intentionBrand: "",
                intentionModel: "",
                provinceName: "",
                revenueForecast: "",
                source: "销售录入",
                chance: "",
                wechat: "",
                otherCondition: "",
                workingExperience: "",
                createUserId: '',
                throwFlag: '',
                yuJChJRQ: '', //预计成交日期
                status: '', //成交状态
                throwReason: '', //丢单原因
                limitedPrice: "",
                paymentRatio: "",
                earnestStatus: "",
                earnestMoney: "",
                paymentDate: "",
                amountCollect: "",
                ifReplace: "",
                replaceType: "",
                valuationPrice: "",
                customerAsk: ""
            },
            oldCustomerInfo: {},
            customerInfoNewList: {
                id: "",
                name: "",
                tel: "",
                birthday: "",
                buildCondition: "",
                buyDate: "",
                buyType: "",
                cityName: "",
                competitorCondition: "",
                countyName: "",
                customerCredit: "",
                customerType: "",
                deviceUse: "",
                existingDevice: "",
                intentionBrand: "",
                intentionModel: "",
                provinceName: "",
                revenueForecast: "",
                source: "销售录入",
                chance: "",
                wechat: "",
                otherCondition: "",
                workingExperience: "",
                createUserId: '',
                throwFlag: '',
                yuJChJRQ: '', //预计成交日期
                status: '', //成交状态
                throwReason: '', //丢单原因
                limitedPrice: "",
                paymentRatio: "",
                earnestStatus: "",
                earnestMoney: "",
                paymentDate: "",
                amountCollect: "",
                ifReplace: "",
                replaceType: "",
                valuationPrice: "",
                customerAsk: ""
            },
            checkedModelCustomerLists: [],
            customerVisitList: [],
            YJCJSJ: [],
            customerVisitToday: {
                id: '',
                customerId: '',
                createTime: '',
                visitModel: '',
                createUserId: getUrlParamObj().userId,
                otherCondition: ''
            },
            btns: 0,
            isRegion: getUrlParamObj().isRegion,
            isSelf: getUrlParamObj().isSelf,
            editBtn: false
        },
        methods: {
            showProcess: function () {
                var that = this;
                if (that.type == 'pc' || that.type == 'pcList' || that.type == 'pcbb') {
                    $(".oaLoad").show();
                } else {
                    if (that.newPager == '1') {
                        JSBridge.call(UI, 'showLoading', {})
                    } else {
                        var obj = {
                            dialog: 'show'
                        };
                        prompt(JSON.stringify(obj))
                    }
                }
            },
            //省市县三级联动
            getCity: function (id) {
                var that = this;
                axios.post('/intentCustomer/getForProvinceById.json', {
                    'id': id
                })
                    .then(function (r) {
                        that.cityList = r.records;
                    })
            },
            getCounty: function (id) {
                var that = this;
                axios.post('/intentCustomer/getForProvinceById.json', {
                    'id': id
                })
                    .then(function (r) {
                        console.log(r);
                        that.countyList = r.records;
                    })

            },
            selectAddress: function (id) {
                if (this.type && this.type == 'pc') {

                } else {
                    var obj = {
                        type: 'chooseAddress',
                        id: id,
                    }
                    if (this.type && this.type != 'pc' && this.type != 'pcList' && this.type != 'pcbb') {
                        prompt(JSON.stringify(obj))
                    }
                }
            },
            getRegionByAddress:function(type){
                var that=this;
                console.log(that.customerInfo.provinceName+that.customerInfo.cityName+that.customerInfo.countyName)
                axios.post('/intentionCustomerManagement/getRegionByAddress.json', {
                    'provinceName': that.customerInfo.provinceName,
                    'cityName':that.customerInfo.cityName,
                    'countyName':that.customerInfo.countyName
                })
                    .then(function (r) {
                        that.regionList = r;
                        console.log(that.regionList+that.type)
                        /*if (r&&r.length>0&&type&&type=='1'){*/
                            that.customerInfo.regionId=r[0].regionId
                            console.log(that.customerInfo.regionId)
                            that.getGenZrByRegionId();
                       /* }*/
                    })
            },
            //对应区域
            getGenZrByRegionId:function(){
                var that=this;
                axios.post('/intentionCustomerManagement/getGenZrByRegionId.json', {
                    'regionId': that.customerInfo.regionId
                })
                    .then(function (r) {
                        console.log(r)
                        that.genZR= r.genZR;
                    })
            },
            getCustomerInfoById: function () {
                var that = this;
                axios.post(urlConfig.intentionCustomerManagement.getCustomerInfoById,{
                    "customerId": that.customerId,
                    "userId": that.userId
                })
                    .then(function (data) {
                        console.log(data)
                        var obj = {
                            dialog: 'hidden'
                        }

                        if (that.type && that.type != 'pc' && that.type != 'pcList' && that.type != 'pcbb') {
                            prompt(JSON.stringify(obj))
                        }
                        that.customerInfo = data.customerInfo;
                        that.oldCustomerInfo = that.clone(data.customerInfo);
                        that.YJCJSJFunction();
                        if (that.customerInfo) {
                            if (that.userInfo.roleName == '大区经理' || that.userInfo.roleName == '区域经理' || that.userInfo.roleName == '区域总监' || that.userInfo.roleName == '区域组长') {
                                that.pageType = 'edit'
                            } else {
                                // that.pageType = 'look'
                            }
                            if (that.isSelf == '0') {
                                that.pageType = 'look'
                            }
                            if (that.pageType == 'look') {
                                that.customerInfo.tel = that.telNumber(that.customerInfo.tel);
                                that.customerInfo.wechat = '******'
                                console.log(that.customerInfo.tel)
                            }
                        }

                        that.customerVisitList = data.customerVisitList;
                        if (data.customerVisitToday != 'null') {
                            that.customerVisitToday = data.customerVisitToday
                        }

                        if (data.customerInfo.intentionModel) {
                            console.log(data.customerInfo.intentionModel.split("、"))
                            that.checkedModelCustomerLists = data.customerInfo.intentionModel.split("、");
                        } else {
                            that.checkedModelCustomerLists = [];
                        }
                        that.getLimitedPrice(data.customerInfo.intentionModel);
                        that.getRegionByAddress();
                        that.getBran();


                    })
            },
            clone: function (obj) {
                var str, newobj = obj.constructor === Array ? [] : {};
                if (typeof obj !== 'object') {
                    return;
                } else if (window.JSON) {
                    str = JSON.stringify(obj), //序列化对象
                        newobj = JSON.parse(str); //还原
                } else {
                    for (var i in obj) {
                        newobj[i] = typeof obj[i] === 'object' ? cloneObj(obj[i]) : obj[i];
                    }
                }
                return newobj;
            },
            // 电话号码中间用*代替
            telNumber: function (telNum) {
                var firstTelNum = telNum.substring(0, 3);
                var lastTelNum = telNum.substring(telNum.length - 4, telNum.length);
                return firstTelNum + "****" + lastTelNum;
            },
            //日期格式限制
            isDate: function (val) {
                var pattern = /^((19[2-9]\d{1})|(20((0[0-9])|(1[0-8]))))\-((0?[1-9])|(1[0-2]))\-((0?[1-9])|([1-2][0-9])|30|31)$/;
                if (pattern.test(val)) {
                    var date = new Date(val);
                    var month = val.substring(val.indexOf("-") + 1, val.lastIndexOf("-"));
                    return date && (date.getMonth() + 1 == parseInt(month));
                }
                return false;
            },
            //判断是否为小数或数字
            checkNum: function (num, type, dil) {
                var that = this;
                that.newPager = getUrlParamObj().newPager;
                var re = /^\d+(?=\.{0,1}\d+$|$)/;
                //如果带小数点，判断小数点前边的位数
                console.log(num, dil);
                num = num + "";
                if (num.indexOf(".") != -1) {
                    if (dil != '1') {
                        if (that.newPager == '1') {
                            that.showToast("不能输入小数")
                        } else {
                            alert("不能输入小数");
                        }
                        that.customerInfo[type] = "";
                    }
                    return false;
                } else {
                    if (num.length > 3) {
                        if (dil != '1') {
                            if (that.newPager == '1') {
                                that.showToast("请输入最多三位数")
                            } else {
                                alert("请输入最多三位数");
                            }
                            that.customerInfo[type] = "";
                        }
                        return false;
                    } else {
                        if (num != "") {
                            if (!re.test(num)) {
                                if (dil != '1') {
                                    if (that.newPager == '1') {
                                        that.showToast("输入格式不正确")
                                    } else {
                                        alert("输入格式不正确");
                                    }
                                    that.customerInfo[type] = "";
                                }
                                return false;
                            } else {
                                return true
                            }
                        }
                    }
                }

            },
            YJCJSJFunction: function () {
                var that = this;
                that.YJCJSJ = [];
                var buyDate = that.customerInfo.buyDate;
                var dateTime = new Date().Format("yyyy-MM-dd");
                var today = parseInt(dateTime.substring(8, 10));
                var month = parseInt(dateTime.substring(5, 7));
                //本月内 下月内
                if (buyDate == 'todayMonth' || buyDate == 'nextMonth') {
                    if (Number(today) < 11) {
                        var nextMonth = parseInt(Number(month) + 1);
                        that.YJCJSJ.push(month + '月上旬');
                        that.YJCJSJ.push(month + '月中旬');
                        that.YJCJSJ.push(month + '月下旬');
                        that.YJCJSJ.push(nextMonth + '月上旬');
                        that.YJCJSJ.push(nextMonth + '月中旬');
                        that.YJCJSJ.push(nextMonth + '月下旬');
                    } else if (Number(today) < 21) {
                        var nextMonth = parseInt(Number(month) + 1);
                        that.YJCJSJ.push(month + '月中旬');
                        that.YJCJSJ.push(month + '月下旬');
                        that.YJCJSJ.push(nextMonth + '月上旬');
                        that.YJCJSJ.push(nextMonth + '月中旬');
                        that.YJCJSJ.push(nextMonth + '月下旬');
                    } else {
                        var nextMonth = parseInt(Number(month) + 1);
                        that.YJCJSJ.push(month + '月下旬');
                        that.YJCJSJ.push(nextMonth + '月上旬');
                        that.YJCJSJ.push(nextMonth + '月中旬');
                        that.YJCJSJ.push(nextMonth + '月下旬');
                    }
                } else {
                    that.customerInfo.yjOkDate = '';
                    that.YJCJSJ = [];
                }
            },
            getLimitedPrice: function (intentionModel) {
                var that = this;
                axios.post("/intentionCustomerManagement/getLimitedPrice.json",{
                    'intentionModel': intentionModel
                })
                    .then(function (r) {
                        that.customerInfo.limitedPrice = r.string;
                    })

            },
            //品牌
            getBran: function () {
                var that = this;
                axios.post('/deviceBrand/getBrandByCompanyId.json', {
                    'companyId':that.userInfo.companyId
                })
                    .then(function (r) {
                        that.itemsBran = r.brands;
                        that.getModel('1');
                    })
            },
            getModel: function (type) {
                var that = this;
                var brandId;
                if (type != '1') {
                    that.customerInfo.intentionModel = '';
                    that.checkedModelCustomerLists = []
                }
                console.log(that.itemsBran)
                for (var i = 0; i < that.itemsBran.length; i++) {
                    console.log(that.customerInfo.intentionBrand, that.itemsBran[i].brandName)
                    if (that.customerInfo.intentionBrand == that.itemsBran[i].brandName) {
                        brandId = that.itemsBran[i].id
                    }
                }
                axios.post('/deviceBrand/getDeviceTypeList.json', {
                    brandId: brandId,
                    companyId: that.companyId
                })
                    .then(function (r) {
                        that.itemsDeviceType = r.devicetypes;
                        console.log(that.itemsDeviceType)
                        for (var i = 0; i < that.itemsDeviceType.length; i++) {
                           /* that.itemsDeviceType[i].itemsMod = []*/
                            that.getModelByType(that.itemsDeviceType[i]);

                        }
                    })
                /*for (var j = 0; j < that.itemsDeviceType.length; j++) {

                }*/
            },
            getModelByType: function (item) {
                var that = this;
                axios.post(urlConfig.intentionCustomerManagement.getModelByBrandName, {
                    'brandName': that.customerInfo.intentionBrand,
                    'deviceTypeId': item.id
                })
                    .then(function (r) {
                        if (r.modelInfo) {
                            item.itemsMod = r.modelInfo;
                        }
                    })

            },
            /*getModel: function (type) {
                var that = this;
                var brandId;
                if (type != '1') {
                    that.customerInfo.intentionModel = '';
                    that.checkedModelCustomerLists = []
                }
                console.log(that.itemsBran)
                for (var i = 0; i < that.itemsBran.length; i++) {
                    console.log(that.customerInfo.intentionBrand, that.itemsBran[i].brandName)
                    if (that.customerInfo.intentionBrand == that.itemsBran[i].brandName) {
                        brandId = that.itemsBran[i].id
                        console.log(brandId)
                    }
                }
                axios.post('/deviceBrand/getDeviceTypeList.json', {
                    brandId: brandId,
                    companyId: that.companyId
                })
                    .then(function (r) {
                        that.itemsDeviceType = r.devicetypes;
                        console.log(that.itemsDeviceType)
                        for (var i = 0; i < that.itemsDeviceType.length; i++) {
                            that.itemsDeviceType[i].itemsMod = []
                        }
                    }, true)
                for (var j = 0; j < that.itemsDeviceType.length; j++) {
                    that.getModelByType(that.itemsDeviceType[j]);

                }
            },
            getModelByType: function (item) {
                var that = this;
                alert(that.customerInfo.intentionBrand);
                axios.post(urlConfig.intentionCustomerManagement.getModelByBrandName,{
                    'brandName': that.customerInfo.intentionBrand,
                    'deviceTypeId': item.id
                }).then(function (r) {
                        if (r.modelInfo) {
                            item.itemsMod = r.modelInfo;
                        }
                        that.itemsDeviceType=that.itemsDeviceType.concat(item);
                    },true)

                console.log(that.itemsDeviceType)
            },*/
            showDatePicker: function (e) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.customerInfo.paymentDate = dp.cal.getNewDateStr();
                        return true;
                    },
                });
                $(e.target).blur();
            },
            formatDate: function (now) {
//                return  NewDate(now).Format(TimeFormat.pcList)
                return new Date(now).Format(TimeFormat.middle)
            },
            showDivModel: function (event) {
                $("#selectModel").css({
                    "left": "100px",
                    "top": (event.pageY) + "px"
                }).show();
            },
            hiddenDivModel: function () {
                $("#selectModel").hide();
            },
            getIntentionModel: function () {
                if (this.checkedModelCustomerLists.length > 0) {
                    var checkedModelCustomerString = "";
                    for (var j = 0; j < this.checkedModelCustomerLists.length; j++) {
                        if (this.checkedModelCustomerLists[j] != "") {
                            checkedModelCustomerString += this.checkedModelCustomerLists[j] + "、";
                        }
                    }
                    this.customerInfo.intentionModel = checkedModelCustomerString.substring(0, checkedModelCustomerString.length - 1);

                } else {
                    this.customerInfo.intentionModel = ""
                }
                this.hiddenDivModel();
                this.getLimitedPrice(this.customerInfo.intentionModel);

            },
            fmoney: function (s, n) {
                if (!s) {
                    s = 0;
                }
                n = n > 0 && n <= 20 ? n : 2;
                s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1],
                    t = "";
                for (i = 0; i < l.length; i++) {
                    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                }
                return t.split("").reverse().join("") + "." + r;
            },
            c_status: function () {
                var that = this;
                if (that.customerInfo.status == '丢单' || that.customerInfo.status == '已成交') {
                    that.customerInfo.intentionFlag = 0;
                } else {
                    that.customerInfo.intentionFlag = 1;
                }
            },
            checkedOne: function (moduleKey) {
                var idIndex = this.checkedModelCustomerLists.indexOf(moduleKey)
                if (idIndex >= 0) {
                    this.checkedModelCustomerLists.splice(idIndex, 1)
                } else {
                    this.checkedModelCustomerLists.push(moduleKey)
                }

                console.log(this.checkedModelCustomerLists);
            },
            hideProcess: function () {
                var that = this;
                if (that.type == 'pc' || that.type == 'pcList' || that.type == 'pcbb') {
                    $(".oaLoad").hide();
                } else {
                    if (that.newPager == '1') {
                        JSBridge.call(UI, 'hideLoading')
                    } else {
                        var obj = {
                            dialog: 'hidden'
                        };
                        prompt(JSON.stringify(obj))
                    }
                }
            },
            showToast: function (title) {
                var param = {
                    title: title
                }
                JSBridge.call(UI, 'showToast', param)
            },
            showSave: function (type) {
                var that = this;
                if (that.type == 'pc' || that.type == 'pcList' || that.type == 'pcbb') {
                    that.showToast("保存成功")
                } else {
                    alert(type)
                }
            },
            save: function () {
                var that = this;
                delete that.customerInfo.createTime;
                delete that.customerInfo.updateTime;
                if (that.customerInfo.status == '丢单' || that.customerInfo.status == '已成交') {
                    that.customerInfo.intentionFlag = "0"
                }
                if (that.customerInfo.status == '') {
                    if (that.newPager == '1') {
                        that.showToast("请输入成交状态")
                    } else {
                        alert("请输入成交状态");
                    }
                    return false;
                }
                if (that.customerInfo.status == '丢单' && that.customerInfo.throwReason == '') {
                    if (that.newPager == '1') {
                        that.showToast("请输入丢单原因")
                    } else {
                        alert("请输入丢单原因");
                    }
                    return false;
                }
                if (that.customerInfo.intentionFlag != "0") {
                    if (that.customerInfo.name == "") {
                        if (that.newPager == '1') {
                            that.showToast("请输入客户姓名")
                        } else {
                            alert("请输入客户姓名");
                        }
                        return false;
                    }

                    if (that.customerInfo.tel == "") {
                        if (that.newPager == '1') {
                            that.showToast("请输入客户手机号码")
                        } else {
                            alert("请输入客户手机号码");
                        }
                        return false;
                    }
                    if (that.customerInfo.ifReplace == '' && that.customerInfo.ifReplace != 0) {
                        if (that.newPager == '1') {
                            that.showToast("请选择是否置换")
                        } else {
                            alert("请选择是否置换");
                        }
                        return false;
                    }

                    //选择置换后必填
                    if (that.customerInfo.ifReplace == '1') {
                        if (that.customerInfo.replaceType == "") {
                            if (that.newPager == '1') {
                                that.showToast("请填写置换品牌机型")
                            } else {
                                alert("请填写置换品牌机型");
                            }
                            return false;
                        }
                        if (that.customerInfo.valuationPrice == "") {
                            if (that.newPager == '1') {
                                that.showToast("请填写评估价")
                            } else {
                                alert("请填写评估价");
                            }
                            return false;
                        } else {
                            if (that.checkNum(that.customerInfo.valuationPrice, "valuationPrice", "1") == false) {
                                if (that.newPager == '1') {
                                    that.showToast("请输入正确的评估价")
                                } else {
                                    alert("请输入正确的评估价");
                                }
                                return false;
                            }
                        }
                        if (that.customerInfo.customerAsk == "") {
                            if (that.newPager == '1') {
                                that.showToast("请填写客户要价")
                            } else {
                                alert("请填写客户要价");
                            }
                            return false;
                        } else {
                            if (that.checkNum(that.customerInfo.customerAsk, "customerAsk", "1") == false) {
                                if (that.newPager == '1') {
                                    that.showToast("请输入正确的客户要价")
                                } else {
                                    alert("请输入正确的客户要价");
                                }
                                return false;
                            }
                        }


                    }
                    if (that.customerInfo.tel.length != 11) {
                        if (that.newPager == '1') {
                            that.showToast("手机号格式不正确")
                        } else {
                            alert("手机号格式不正确");
                        }
                        return false;
                    }

                    if (that.customerInfo.customerType == "") {
                        if (that.newPager == '1') {
                            that.showToast("客户类型不能为空")
                        } else {
                            alert("客户类型不能为空");
                        }
                        return false;
                    }

                    if (that.customerInfo.customerCredit == "") {
                        if (that.newPager == '1') {
                            that.showToast("客户信用不能为空")
                        } else {
                            alert("客户信用不能为空");
                        }
                        return false;
                    }
                    if (that.customerInfo.source == "") {
                        if (that.newPager == '1') {
                            that.showToast("客户来源不能为空")
                        } else {
                            alert("客户来源不能为空");
                        }
                        return false;
                    }

                    if (!that.isDate(that.customerInfo.birthday) && that.customerInfo.birthday != "") {
                        if (that.newPager == '1') {
                            that.showToast("生日格式不正确，例如1998-01-01")
                        } else {
                            alert("生日格式不正确，例如1998-01-01");
                        }
                        return false;
                    }
                    if (that.customerInfo.chance == "") {
                        if (that.newPager == '1') {
                            that.showToast("请选择成交概率")
                        } else {
                            alert("请选择成交概率");
                        }
                        return false;
                    }

                    if (that.customerInfo.countyName == "") {
                        if (that.newPager == '1') {
                            that.showToast("客户地址不能为空，且必须精确到县！")
                        } else {
                            alert("客户地址不能为空，且必须精确到县！");
                        }
                        return false;
                    }
                    if (that.customerInfo.regionId == "") {
                        if (that.newPager == '1') {
                            that.showToast("对应区域不能为空！")
                        } else {
                            alert("对应区域不能为空！");
                        }
                        return false;
                    }
                    if (that.customerInfo.intentionBrand == "") {
                        if (that.newPager == '1') {
                            that.showToast("请输入意向品牌")
                        } else {
                            alert("请输入意向品牌");
                        }
                        return false;
                    }

                    if (that.customerInfo.intentionModel == "") {
                        if (that.newPager == '1') {
                            that.showToast("请输入意向机型")
                        } else {
                            alert("请输入意向机型");
                        }
                        return false;
                    }
                    if (that.customerInfo.buyDate == "") {
                        if (that.newPager == '1') {
                            that.showToast("请输入客户购买时间")
                        } else {
                            alert("请输入客户购买时间");
                        }
                        return false;
                    }
                    if (that.customerInfo.buyDate == 'todayMonth' || that.customerInfo.buyDate == 'nextMonth') {
                        if (that.customerInfo.yjOkDate == '' || that.YJCJSJ.indexOf(that.customerInfo.yjOkDate) == -1) {
                            if (that.newPager == '1') {
                                that.showToast("请输入客户预计成交时间")
                            } else {
                                alert("请输入客户预计成交时间");
                            }
                            return false;
                        }
                    }
                    if (that.customerInfo.quote == "") {
                        if (that.newPager == '1') {
                            that.showToast("请输入客户报价")
                        } else {
                            alert("请输入客户报价");
                        }
                        return false;
                    } else {
                        if (that.checkNum(that.customerInfo.quote, "quote", "1") == false) {
                            if (that.newPager == '1') {
                                that.showToast("请输入正确的客户报价")
                            } else {
                                alert("请输入正确的客户报价");
                            }
                            return false;
                        }
                    }
                    if (that.customerInfo.psychologicalPrice == "") {
                        if (that.newPager == '1') {
                            that.showToast("请输入客户心理价格")
                        } else {
                            alert("请输入客户心理价格");
                        }
                        return false;
                    } else {
                        console.log(that.checkNum(that.customerInfo.psychologicalPrice, "psychologicalPrice", "1"))
                        if (that.checkNum(that.customerInfo.psychologicalPrice, "psychologicalPrice", "1") == false) {
                            if (that.newPager == '1') {
                                that.showToast("请输入正确的客户心理价格")
                            } else {
                                alert("请输入正确的客户心理价格");
                            }
                            return false;
                        }
                    }
                    if (that.customerInfo.intentionFlag == 1) {

                        if (that.customerInfo.buyType == '') {
                            if (that.newPager == '1') {
                                that.showToast("请输入购买方式")
                            } else {
                                alert("请输入购买方式");
                            }
                            return false;
                        }
                        if (that.customerInfo.existingDevice == '') {
                            if (that.newPager == '1') {
                                that.showToast("请输入现有设备")
                            } else {
                                alert("请输入现有设备");
                            }
                            return false;
                        }
                        if (that.customerInfo.workingExperience == '') {
                            if (that.newPager == '1') {
                                that.showToast("请输入从业经验")
                            } else {
                                alert("请输入从业经验");
                            }
                            return false;
                        }
                        if (that.customerInfo.buildCondition == '') {
                            if (that.newPager == '1') {
                                that.showToast("请输入工程情况")
                            } else {
                                alert("请输入工程情况");
                            }
                            return false;
                        }
                        if (that.customerInfo.revenueForecast == '') {
                            if (that.newPager == '1') {
                                that.showToast("请输入收入预测")
                            } else {
                                alert("请输入收入预测");
                            }
                            return false;
                        }
                        if (that.customerInfo.competitorCondition == '') {
                            if (that.newPager == '1') {
                                that.showToast("请输入竞争对手")
                            } else {
                                alert("请输入竞争对手");
                            }
                            return false;
                        }
                    }
                }
                that.customerInfo.createUserId = that.userId;
                var t = new Date();
                var nowYear = t.getFullYear();
                var nowMonth = t.getMonth() + 1;//0-11 0代表一月
                var nowDate = t.getDate();

                //根据购买时间判断预计成交日期
                switch (that.customerInfo.buyDate) {
                    case '七天内':
                        t.setDate(nowDate + 7);
                        that.customerInfo.yuJChJRQ = t.getFullYear() + '-' + (t.getMonth() + 1 >= 10 ? t.getMonth() + 1 : '0' + (t.getMonth() + 1)) + '-' + (t.getDate() >= 10 ? t.getDate() : '0' + t.getDate());
                        break;
                    case '本月内':
                        that.customerInfo.yuJChJRQ = nowYear + '-' + (nowMonth >= 10 ? nowMonth : '0' + nowMonth) + '-' + that.getLastDate(nowYear, nowMonth);
                        break;
                    case '一月内':
                        t.setDate(nowDate + 30);
                        that.customerInfo.yuJChJRQ = t.getFullYear() + '-' + (t.getMonth() + 1 >= 10 ? t.getMonth() + 1 : '0' + (t.getMonth() + 1)) + '-' + (t.getDate() >= 10 ? t.getDate() : '0' + t.getDate());
                        break;
                    case '三月内':
                        t.setMonth(nowMonth + 2);
                        that.customerInfo.yuJChJRQ = t.getFullYear() + '-' + (t.getMonth() + 1 >= 10 ? t.getMonth() + 1 : '0' + (t.getMonth() + 1)) + '-' + (t.getDate() >= 10 ? t.getDate() : '0' + t.getDate());
                        break;
                    case '丢单':
                        that.customerInfo.yuJChJRQ = '-1'
                        break;
                    case '已成交':
                        that.customerInfo.yuJChJRQ = '1'
                        break;
                    case '半年内':
                        t.setMonth(nowMonth + 5);
                        that.customerInfo.yuJChJRQ = t.getFullYear() + '-' + (t.getMonth() + 1 >= 10 ? t.getMonth() + 1 : '0' + (t.getMonth() + 1)) + '-' + (t.getDate() >= 10 ? t.getDate() : '0' + t.getDate());
                        break;
                }
                that.showProcess();
                axios.post(urlConfig.intentionCustomerManagement.saveIntentCustomerInfo, that.customerInfo
                )
             .then(function (data) {
                        console.log(data)
                        that.hideProcess();
                        if (data.records == '保存成功' && that.isAdd != 1) {
                            that.customerVisitToday.customerId = that.customerInfo.id;
                            delete that.customerVisitToday.createTime;

                            console.log(data.records)
                            if (data.records == '保存成功') {
                                if (that.newPager == '1') {
                                    that.showToast("保存成功")
                                } else {

                                    that.showSave("保存成功")
                                }
                                ;
                                if (that.type != 'pc' && that.type != 'pcList' && that.type != 'pcbb') {
                                    if (that.newPager == '1') {
                                        var param = {
                                            backRefresh: true,       //是否返回刷新
                                            data:'someRefresh'
                                        }
                                        JSBridge.call(ROUTER, 'navigateBack', param)
                                    } else {
                                        var obj = {
                                            activity: 'closePage'
                                        }
                                        prompt(JSON.stringify(obj))
                                    }
                                }
                                if (that.type == 'pcbb') {
                                    parent.refresh();
                                    api.close();
                                } else {
                                    if (that.type == 'pc') {
                                        var pageId = top.getActivePageId();
                                        var $iframe = top.findIframeById(pageId);
                                        console.log($iframe[0].contentWindow.app.report.todayVisitCustomer[that.index])
                                        if (that.customerInfo.birthday) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].birthday = that.customerInfo.birthday
                                        }
                                        if (that.customerInfo.intentionFlag) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].intentionFlag = that.customerInfo.intentionFlag
                                        }
                                        if (that.customerInfo.buildCondition) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buildCondition = that.customerInfo.buildCondition
                                        }
                                        if (that.customerInfo.buyDate) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buyDate = that.customerInfo.buyDate
                                        }
                                        if (that.customerInfo.buyType) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buyType = that.customerInfo.buyType
                                        }
                                        if (that.customerInfo.chance) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].chance = that.customerInfo.chance
                                        }
                                        if (that.customerInfo.cityName) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].cityName = that.customerInfo.cityName
                                        }
                                        if (that.customerInfo.competitorCondition) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].competitorCondition = that.customerInfo.competitorCondition
                                        }
                                        if (that.customerInfo.countyName) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].countyName = that.customerInfo.countyName
                                        }
                                        if (that.customerInfo.customerCredit) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].customerCredit = that.customerInfo.customerCredit
                                        }
                                        if (that.customerInfo.customerType) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].customerType = that.customerInfo.customerType
                                        }
                                        if (that.customerInfo.deviceUse) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].deviceUse = that.customerInfo.deviceUse
                                        }
                                        if (that.customerInfo.existingDevice) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].existingDevice = that.customerInfo.existingDevice
                                        }
                                        if (that.customerInfo.intentionBrand) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].intentionBrand = that.customerInfo.intentionBrand
                                        }
                                        if (that.customerInfo.intentionModel) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].intentionModel = that.customerInfo.intentionModel
                                        }
                                        if (that.customerInfo.name) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].name = that.customerInfo.name
                                        }
                                        if (that.customerInfo.revenueForecast) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].revenueForecast = that.customerInfo.revenueForecast
                                        }
                                        if (that.customerInfo.source) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].source = that.customerInfo.source
                                        }
                                        if (that.customerInfo.tel) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].tel = that.customerInfo.tel
                                        }
                                        if (that.customerInfo.provinceName) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].provinceName = that.customerInfo.provinceName
                                        }
                                        console.log($iframe[0].contentWindow.app.report.todayVisitCustomer[that.index])
                                        api.close();
                                    } else {
                                        var pageId = top.getActivePageId();
                                        var $iframe = top.findIframeById(pageId);
                                        for (var i = 0; i < $iframe[0].contentWindow.app.report.todayVisitCustomer.length; i++) {
                                            if (that.customerId == $iframe[0].contentWindow.app.report.todayVisitCustomer[i].customerId) {
                                                that.index = i;
                                            }
                                        }
                                        if (that.index) {
                                            if (that.customerInfo.birthday) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].birthday = that.customerInfo.birthday
                                            }
                                            if (that.customerInfo.intentionFlag) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].intentionFlag = that.customerInfo.intentionFlag
                                            }
                                            if (that.customerInfo.buildCondition) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buildCondition = that.customerInfo.buildCondition
                                            }
                                            if (that.customerInfo.buildCondition) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buildCondition = that.customerInfo.buildCondition
                                            }
                                            if (that.customerInfo.buyDate) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buyDate = that.customerInfo.buyDate
                                            }
                                            if (that.customerInfo.buyType) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buyType = that.customerInfo.buyType
                                            }
                                            if (that.customerInfo.chance) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].chance = that.customerInfo.chance
                                            }
                                            if (that.customerInfo.cityName) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].cityName = that.customerInfo.cityName
                                            }
                                            if (that.customerInfo.competitorCondition) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].competitorCondition = that.customerInfo.competitorCondition
                                            }
                                            if (that.customerInfo.countyName) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].countyName = that.customerInfo.countyName
                                            }
                                            if (that.customerInfo.customerCredit) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].customerCredit = that.customerInfo.customerCredit
                                            }
                                            if (that.customerInfo.customerType) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].customerType = that.customerInfo.customerType
                                            }
                                            if (that.customerInfo.deviceUse) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].deviceUse = that.customerInfo.deviceUse
                                            }
                                            if (that.customerInfo.existingDevice) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].existingDevice = that.customerInfo.existingDevice
                                            }
                                            if (that.customerInfo.intentionBrand) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].intentionBrand = that.customerInfo.intentionBrand
                                            }
                                            if (that.customerInfo.intentionModel) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].intentionModel = that.customerInfo.intentionModel
                                            }
                                            if (that.customerInfo.name) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].name = that.customerInfo.name
                                            }
                                            if (that.customerInfo.revenueForecast) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].revenueForecast = that.customerInfo.revenueForecast
                                            }
                                            if (that.customerInfo.source) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].source = that.customerInfo.source
                                            }
                                            if (that.customerInfo.tel) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].tel = that.customerInfo.tel
                                            }
                                            if (that.customerInfo.provinceName) {
                                                $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].provinceName = that.customerInfo.provinceName
                                            }
                                            parent.app.refreshList();
                                            api.close();
                                        } else {
                                            parent.app.refreshList();
                                            api.close();
                                        }
                                    }

                                }
                                //返回列表页
                            } else {
                                if (that.newPager == '1') {
                                    that.showToast("保存失败")
                                } else {
                                    alert("保存失败");
                                }
                                return false;
                            }
                        } else if (data.records == '电话号码已存在') {
                            if (that.newPager == '1') {
                                that.showToast("电话号码已存在")
                            } else {
                                alert("电话号码已存在")
                            }
                            return false
                        } else {
                            if (that.newPager == '1') {
                                that.showToast("保存成功")
                            } else {
                                that.showSave("保存成功")
                            }
                            var obj = {
                                activity: 'closePage'
                            }
                            if (that.type != 'pc' && that.type != 'pcList' && that.type != 'pcbb') {
                                if (that.newPager == '1') {
                                    var param = {
                                        backRefresh: true,       //是否返回刷新
                                        data:'someRefresh'
                                    }
                                    JSBridge.call(ROUTER, 'navigateBack', param)
                                } else {
                                    prompt(JSON.stringify(obj))
                                }
                            } else {
                                parent.app.refreshList();
                                api.close();
                            }
                            return false;
                        }
                    })
            }
        },
        watch: {
            customerInfo: {
                deep: true,
                handler: function (newVal, oldVal) {
                    var that = this;
                    that.yuce = getUrlParamObj().yuce;
                    if (that.yuce == '1') {
                        if (that.pageType == 'edit') {
                            if (that.isObjectValueEqual(newVal, that.oldCustomerInfo)) {
                                that.editBtn = false;
                            } else {
                                that.editBtn = true;
                            }
                        }
                    } else {
                        that.editBtn = true;
                    }


                }
            }
        },
        mounted: function () {
            var that = this;
            axios.post(urlConfig.system.user.getUserViewById, {
                id: that.userId
            })
                .then(function (r) {
                    console.log(r)
                    that.userInfo = r;
                    that.getBran();
                })
            that.index = getUrlParamObj().index;
            if (getUrlParamObj().isAdd != 1) {
                var obj = {
                    dialog: 'show'
                }
                if (that.type && that.type != 'pc' && that.type != 'pcList' && that.type != 'pcbb') {
                    prompt(JSON.stringify(obj))
                }
                that.getCustomerInfoById();
            }
            axios.post('/intentCustomer/getForProvinceById.json', {
                'id': '0'
            })
                .then(function (r) {
                    console.log(r);
                    that.provinceList = r.records;
                })
            axios.post('/enum2/selectByModuleType.json', {
                moduleType: 'buyDate'
            })
                .then(function (r) {
                    var list = r;
                    that.buyDateList = r;
                    if (list && list.length > 0) {
                        that.buyDateObj = new Map();
                        for (var i = 0; i < list.length; i++) {
                            var k = list[i].key;
                            var v = list[i].value;

                            that.buyDateObj.set(k, v);
                        }
                    }
                })



        }
    })
</script>

</body>
</html>